package fr.afcepf.ai89.esharing.tests;

import java.util.Date;
import java.util.List;

import fr.afcepf.ai89.esharing.entity.Avis;
import fr.afcepf.ai89.esharing.entity.Emprunt;
import fr.afcepf.ai89.esharing.entity.NoteAvis;
import fr.afcepf.ai89.esharing.entity.Proprietaire;
import fr.afcepf.ai89.esharing.metier.BusinessPretAem;
import fr.afcepf.ai89.esharing.metier.IBusinessPretAem;

public class BusinessPretAemTest {

	public static void main(String[] args) {
		IBusinessPretAem busPretAem=new BusinessPretAem();
			
		/*Avis avis= new Avis();
		NoteAvis noteAvis= new NoteAvis();
		avis.setNoteAvis(noteAvis);
		avis.setCommentairesLibres("Pas terrible");
		avis.getNoteAvis().setIdNote(2);
		 int numberAvis= busPretAem.addAvis( avis);
		 System.out.println(numberAvis);*/
		
		//Proprietaire prop= new Proprietaire();
		//prop.setIdUtilisateur(2);
		//List<Emprunt> tousLesPrets = busPretAem.getPrets(prop);
		/*for (Emprunt emp : tousLesPrets) {
			
			// Still need to test for how to override the nulls when it's valueOf a string but it works!!!
			
			System.out.println(emp.getIdEmprunt() + " de " + 
							   emp.getAem().getProprietaire().getNomUtilisateur() + " � " + 
							   emp.getProprietaire().getNomUtilisateur() + " " +
							   emp.getAem().getMarque().getMarque() + " " + 
							   emp.getAem().getTypeAem().getTypeAem() + " " + 
							   String.valueOf(emp.getDateDemande()) + " " + 
							   String.valueOf(emp.getDateDebut()) + " " + 
							   String.valueOf(emp.getDateFin()) + " " + 
							   String.valueOf(emp.getDateValidation()) + " " +
							   String.valueOf(emp.getDateRestitution()) + " " +
							   String.valueOf(emp.getDateAnnulation()) + " " + 
							   String.valueOf(emp.getMotivationAnnulation()) + " " + 
							   String.valueOf(emp.getDateRefus()) + " " + 
							   String.valueOf(emp.getMotivationRefus()));
			*/
		//Proprietaire prop= new Proprietaire();
				//prop.setIdUtilisateur(2);
		//List<Emprunt> pretsRefuses = busPretAem.getPretsRefuses(prop);
		/*for (Emprunt emp : pretsRefuses) {
		
		// Still need to test for how to override the nulls when it's valueOf a string but it works!!!
		
		System.out.println(emp.getIdEmprunt() + " de " + 
						   emp.getAem().getProprietaire().getNomUtilisateur() + " � " + 
						   emp.getProprietaire().getNomUtilisateur() + " " +
						   emp.getAem().getMarque().getMarque() + " " + 
						   emp.getAem().getTypeAem().getTypeAem() + " " + 
						   String.valueOf(emp.getDateDemande()) + " " + 
						   String.valueOf(emp.getDateDebut()) + " " + 
						   String.valueOf(emp.getDateFin()) + " " + 
						   String.valueOf(emp.getDateValidation()) + " " +
						   String.valueOf(emp.getDateRestitution()) + " " +
						   String.valueOf(emp.getDateAnnulation()) + " " + 
						   String.valueOf(emp.getMotivationAnnulation()) + " " + 
						   String.valueOf(emp.getDateRefus()) + " " + 
						   String.valueOf(emp.getMotivationRefus()));
		*/
		//Proprietaire prop= new Proprietaire();
		//prop.setIdUtilisateur(1);
		//List<Emprunt> pretsAnnules = busPretAem.getPretsAnnules(prop);
/*for (Emprunt emp : pretsAnnules) {
		
		// Still need to test for how to override the nulls when it's valueOf a string but it works!!!
		
		System.out.println(emp.getIdEmprunt() + " de " + 
						   emp.getAem().getProprietaire().getNomUtilisateur() + " � " + 
						   emp.getProprietaire().getNomUtilisateur() + " " +
						   emp.getAem().getMarque().getMarque() + " " + 
						   emp.getAem().getTypeAem().getTypeAem() + " " + 
						   String.valueOf(emp.getDateDemande()) + " " + 
						   String.valueOf(emp.getDateDebut()) + " " + 
						   String.valueOf(emp.getDateFin()) + " " + 
						   String.valueOf(emp.getDateValidation()) + " " +
						   String.valueOf(emp.getDateRestitution()) + " " +
						   String.valueOf(emp.getDateAnnulation()) + " " + 
						   String.valueOf(emp.getMotivationAnnulation()) + " " + 
						   String.valueOf(emp.getDateRefus()) + " " + 
						   String.valueOf(emp.getMotivationRefus()));
		*/
		/*Proprietaire prop= new Proprietaire();
		 * prop.setIdUtilisateur(3);
		//List<Emprunt> pretsNonValides = busPretAem.getPretsNonValides(prop);
		/*for (Emprunt emp : pretsNonValides) {
		
		// Still need to test for how to override the nulls when it's valueOf a string but it works!!!
		
		System.out.println(emp.getIdEmprunt() + " de " + 
						   emp.getAem().getProprietaire().getNomUtilisateur() + " � " + 
						   emp.getProprietaire().getNomUtilisateur() + " " +
						   emp.getAem().getMarque().getMarque() + " " + 
						   emp.getAem().getTypeAem().getTypeAem() + " " + 
						   String.valueOf(emp.getDateDemande()) + " " + 
						   String.valueOf(emp.getDateDebut()) + " " + 
						   String.valueOf(emp.getDateFin()) + " " + 
						   String.valueOf(emp.getDateValidation()) + " " +
						   String.valueOf(emp.getDateRestitution()) + " " +
						   String.valueOf(emp.getDateAnnulation()) + " " + 
						   String.valueOf(emp.getMotivationAnnulation()) + " " + 
						   String.valueOf(emp.getDateRefus()) + " " + 
						   String.valueOf(emp.getMotivationRefus()));
		*/
		/*Proprietaire prop= new Proprietaire();
		 * prop.setIdUtilisateur(2);
		 * List<Emprunt> pretsPasses = busPretAem.getPretsPasses(prop);
		System.out.println(pretsPasses);
		for (Emprunt emp : pretsPasses) {
			
			// Still need to test for how to override the nulls when it's valueOf a string but it works!!!
			
			System.out.println(emp.getIdEmprunt() + " de " + 
							   emp.getAem().getProprietaire().getNomUtilisateur() + " � " + 
							   emp.getProprietaire().getNomUtilisateur() + " " +
							   emp.getAem().getMarque().getMarque() + " " + 
							   emp.getAem().getTypeAem().getTypeAem() + " " + 
							   String.valueOf(emp.getDateDemande()) + " " + 
							   String.valueOf(emp.getDateDebut()) + " " + 
							   String.valueOf(emp.getDateFin()) + " " + 
							   String.valueOf(emp.getDateValidation()) + " " +
							   String.valueOf(emp.getDateRestitution()) + " " +
							   String.valueOf(emp.getDateAnnulation()) + " " + 
							   String.valueOf(emp.getMotivationAnnulation()) + " " + 
							   String.valueOf(emp.getDateRefus()) + " " + 
							   String.valueOf(emp.getMotivationRefus()));
			*/
		/*Emprunt emprunt=new Emprunt();
		emprunt.setIdEmprunt(3);
		int t=busPretAem.validerEmprunt(emprunt);
		System.out.println(t);
		System.out.println(emprunt.getDateValidation());*/
		//marche dans le syst�me
		/*Emprunt emprunt=new Emprunt();
		emprunt.setIdEmprunt(2);
		int t=busPretAem.refuserEmprunt(emprunt);
		System.out.println(t);*/
		/*Emprunt emprunt=new Emprunt();
		emprunt.setIdEmprunt(4);
		int t=busPretAem.annulerEmprunt(emprunt);
		System.out.println(t);*/
		/*Emprunt emprunt=new Emprunt();
		emprunt.setIdEmprunt(5); 
		int t = busPretAem.confirmerAemRendu(emprunt);
		System.out.println(t);*/
		
		Emprunt emprunt=busPretAem.getPret(5);
		Date dateDebut= new Date();
		emprunt.setDateDebut(dateDebut);
		int t = busPretAem.majEmprunt(emprunt);
		System.out.println(dateDebut.toString());
		System.out.println(t);
	}

}

